﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eDoc
{
    public partial class _default : System.Web.UI.Page
    {
        string formatCommand = "smime -in {0} -inform der -verify -noverify -out {1}";
        string command = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request.Url.ToString().Contains("http://"))
            //{
            //    Response.Redirect("https://efbvna.com/login.aspx");
            //}

            Response.Redirect("/login.aspx");
            
        }

        public void ExcuteEmbeded(string pathOpenSSL, string pathEmbeded, string pathNewEmbeded)
        {
            //string path = Server.MapPath("/OpenSSL/openssl.exe");

            //string fileEmbedOut = Server.MapPath("/FileOut/embedded.mobileprovision");
            //string fileIn = Server.MapPath("/FileIn/" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xml");

            string command = string.Format(formatCommand, pathEmbeded, pathNewEmbeded);

            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(pathOpenSSL);
            psi.UseShellExecute = false;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardInput = true;
            psi.RedirectStandardError = true;
            psi.Arguments = command;

            // Start the process
            System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
            //proc.Close();
            //proc.Dispose();
        }
    }
}